<template>
  <div style="position: relative">
    <div class="content">
      <div class="info" v-if="this.$route.query.type == 1 ? true : false">
        <div class="title">基本信息</div>
        <div class="list">
          <div class="item">
            <div class="tit">创建时间</div>
            <div class="desc">
              {{ info.gmtCreated ? info.gmtCreated : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">订单号</div>
            <div class="desc">{{ info.orderNo ? info.orderNo : "-" }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                @click="copyAppId(info.orderNo)"
              ></i>
            </div>
          </div>
          <div class="item">
            <div class="tit">充值用户</div>
            <div class="desc">
              {{ info.memberName ? info.memberName : "-" }}
            </div>
          </div>
          <!-- <div class="item" v-for="(item,idx) of basicInfo.infoList" :key="idx">
            <div class="tit">{{item.title}}</div>
            <div class="desc">{{item.data}}</div>
          </div> -->
        </div>
      </div>
      <div class="info" v-else>
        <div class="title">基本信息</div>
        <div class="list">
          <div
            class="item"
            v-for="(item, index) of basicInfo1.infoList"
            :key="index"
          >
            <div class="tit">{{ item.title }}</div>
            <div class="desc">{{ item.data }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                v-if="item.copy"
                @click="copyAppId(item.data)"
              ></i>
            </div>
          </div>
        </div>
      </div>

      <div class="info" v-if="this.$route.query.type == 1 ? true : false">
        <div class="title">其他信息</div>
        <div class="list">
          <!-- <div class="item" v-for="(item,idx) of payInfo.infoList" :key="idx">
            <div class="tit">{{item.title}}</div>
            <div class="desc">{{ item.data }}</div>
          </div> -->
          <div class="item">
            <div class="tit">充值金额/元</div>
            <div class="desc">{{ info.fmtPayAmt ? info.fmtPayAmt : "-" }}</div>
          </div>
          <div class="item">
            <div class="tit">用户手续费/元</div>
            <div class="desc">{{ info.fmtFeeAmt ? info.fmtFeeAmt : "-" }}</div>
          </div>
          <div class="item">
            <div class="tit">支付渠道</div>
            <div class="desc">
              {{
                info.payformChannel
                  ? info.payformChannel == "wechat"
                    ? "微信"
                    : info.payformChannel == "ali"
                    ? "支付宝"
                    : "汇付"
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付状态</div>
            <div class="desc">{{ info.status ? info.status : "-" }}</div>
          </div>
          <!-- <div class="item">
            <div class="tit">退款状态</div>
            <div class="desc">
              {{ info.refundStatus ? info.refundStatus : "-" }}
            </div>
          </div> -->
        </div>
      </div>
      <div class="info" v-else style="min-width: 800px">
        <div class="title">{{ merchantInfo.title }}</div>
        <div class="list" style="position: relative">
          <div
            class="item"
            v-for="(item, index) of merchantInfo.infoList"
            :key="index"
          >
            <div class="tit" style="margin-left: -43px">{{ item.title }}</div>
            <div class="desc">{{ item.data }}</div>
          </div>
          <!-- <div style="position: absolute;right: 0;top: 10px;color: #03BFC6;cursor: pointer;" @click="openShow=!openShow">{{openShow?'收起':'展开'}}</div> -->
          <div v-if="openShow" style="margin-top: 40px">
            <tr class="openBox">
              <td>原订单号</td>
              <td>退款对象</td>
              <td>退款金额/元</td>
              <td>退款手续费/元</td>
              <td>退款状态</td>
            </tr>
            <div class="openBox1" v-for="(o, oIndex) in openList" :key="oIndex">
              <td>
                {{ o.id }}
              </td>
              <td>
                {{ o.name }}
              </td>
              <td>
                {{ o.num }}
              </td>
              <td>
                {{ o.sxf }}
              </td>
              <td>
                {{ o.type }}
              </td>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="back" @click="backFn">
      <i class="el-icon-close"></i>
    </div>
    <div class="left">
      <el-breadcrumb separator=">" style="margin-bottom: 20px">
        <el-breadcrumb-item v-for="item of breadList" :key="item">{{
          item
        }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  </div>
</template>

<script>
export default {
  name: "rechargeDetail",
  components: {},
  data() {
    return {
      info: {},
      openShow: true,
      breadList: [],
      basicInfo: {
        title: "基本信息",
        infoList: [
          {
            title: "创建时间",
            data: "2023-04-12 13:27:01",
            // copy: "true",
          },
          {
            title: "订单号",
            data: "202304121327016497",
          },
          {
            title: "充值用户",
            data: "云利友3级公司",
          },
        ],
      },
      basicInfo1: {
        title: "基本信息",
        infoList: [
          {
            title: "创建时间",
            data: "2023-01-03 14:00",
          },
          {
            title: "退款批次号",
            data: "YC739008937420535",
            copy: "true",
          },
          {
            title: "退款总金额/元",
            data: "150.00",
          },
          {
            title: "退款总笔数",
            data: "3",
          },
          {
            title: "退款手续费/元",
            data: "0.00",
          },
        ],
      },
      payInfo: {
        title: "业务信息",
        infoList: [
          {
            title: "充值金额/元",
            data: "0.20",
          },
          {
            title: "用户手续费/元",
            data: "0.00",
          },
          {
            title: "支付渠道",
            data: "汇付",
          },
          {
            title: "支付状态",
            data: "支付成功",
          },
          {
            title: "退款状态",
            data: "-",
          },
        ],
      },
      merchantInfo: {
        title: "退款信息",
        infoList: [],
      },
      openList: [
        {
          id: "38594982121131",
          sxf: "22.00",
          name: "amube@zi.nc",
          num: "294.36",
          type: "失败",
        },
        {
          id: "38594982121131",
          sxf: "22.00",
          name: "petvawi@oknu.bd",
          num: "394.36",
          type: "成功",
        },
        {
          id: "38594982121131",
          sxf: "22.00",
          name: "zu@viw.ne",
          num: "924.36",
          type: "成功",
        },
      ],
    };
  },
  created() {
    this.breadList = this.$route.meta.title;
    let id = this.$route.query.id;
    if (id) {
      if (this.$route.query.type == 1) {
        this.$http
          .get(`/api/merchant/balanceCharge/get?id=${id}`)
          .then((res) => {
            if (res.code === "0000") {
              //console.log(res.data);
              this.info = res.data;
            }
          });
      }
    }
  },
  methods: {
    backFn() {
      this.$backTo("/account/rechargeRecord");
    },
    copyAppId(value) {
      const input = document.createElement("input"); // 创建input对象
      input.value = value; // 设置复制内容
      document.body.appendChild(input); // 添加临时实例
      input.select(); // 选择实例内容
      document.execCommand("Copy"); // 执行复制
      document.body.removeChild(input); // 删除临时实例
      this.$message.success("复制成功！");
    },
  },
};
</script>

<style scoped lang="scss">
.content {
  min-height: 780px;
  padding: 160px 100px;
  display: flex;
  justify-content: start;
  flex-wrap: wrap;
  .info {
    width: 33.3%;
    min-width: 500px;
    margin-bottom: 40px;
    padding: 0 2%;
    .title {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      padding-bottom: 15px;
      border-bottom: 1px solid #03bfc6;
    }
    .list {
      margin-top: 35px;
      .item {
        display: flex;
        .tit {
          min-width: 100px;
          margin-right: 32px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #869daa;
          line-height: 40px;
          text-align: right;
        }
        .desc {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #1d1c1c;
          line-height: 40px;
          overflow: hidden;
          word-wrap: break-word;
        }
      }
      .openBox {
        margin-bottom: 20px;
        height: 22px;
        font-size: 15px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 600;
        color: #1d1c1c;
        line-height: 22px;
        display: flex;
        justify-content: start;
        td {
          display: inline-block;
          min-width: 16%;
          padding: 0 40px 0 0;
        }
      }
      .openBox1 {
        margin-bottom: 20px;
        height: 22px;
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 400;
        color: #1d1c1c;
        line-height: 22px;
        display: flex;
        justify-content: start;
        text-align: left;
        td {
          min-width: 16%;
          width: 1px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          padding: 0 40px 0 0;
        }
      }
    }
  }
}
.back {
  position: absolute;
  right: 55px;
  top: 20px;
  font-size: 20px;
  cursor: pointer;
}
.left {
  position: absolute;
  left: 55px;
  top: 31px;
  height: 20px;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #869daa;
  line-height: 20px;
}
// :deep(.el-table__expand-icon) {
//   // position: absolute;
//   // left:140px;
//   float: left;
// }
@media screen and (max-width: 1770px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 520px;
      margin-bottom: 40px;
      padding: 0 5.5%;
    }
  }
}

@media screen and (max-width: 1550px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 488px;
      margin-bottom: 40px;
      padding: 0 2%;
    }
  }
}
</style>
